package cartoon.room.read.room;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import cartoon.room.CartoonHistoryModel;


@Dao
public  interface CarttonReadHistoryDao {


    //添加  传递一个参数 对象
    @Insert
    void addHistoryDao(cartoon.room.read.room.CartoonReadHistoryModel historyModel);

    //添加  可以传递多个参数 对象
    @Insert
    void addsHistoryDao(cartoon.room.read.room.CartoonReadHistoryModel... historyModels);

    //删除
    @Delete
    int deleteHistory(cartoon.room.read.room.CartoonReadHistoryModel... historyModels);

    //修改 传入对象 设置 id 进行修改某一个
    @Update
    int updateHistory(cartoon.room.read.room.CartoonReadHistoryModel... historyModels);



    //根据id查询
    @Query("select * from CartoonReadHistoryModel where id =:numb")
 CartoonReadHistoryModel getHistoryId(Integer numb);

    //删除所有
    @Query("delete from CartoonReadHistoryModel")
    void deleteTableData();

    //查询所有
    @Query("SELECT * FROM CartoonReadHistoryModel")
    LiveData<List<cartoon.room.read.room.CartoonReadHistoryModel>> getAllSLive();

}
